package com.dries.portal.module.xxshop.controller;

import com.dries.common.api.CommonResult;
import com.dries.portal.module.xxshop.entity.Shopimage;
import com.dries.portal.module.xxshop.service.IShopimageService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;

/**
 * 
 *
 * @author dries
 * @email samphsanie@gmail.com
 * @date 2020-10-14 14:11:07
 */
@RestController
@RequestMapping("xxshop/shopimage")
public class ShopimageController {

    @Resource
    private IShopimageService shopimageService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public CommonResult list(@RequestParam Map<String, Object> params){

        
        return CommonResult.success();
    }


    /**
     * 信息
     */
    @GetMapping("/info/{imgid}")
    public CommonResult info(@PathVariable("imgid") Long imgid){
		Shopimage shopimage = shopimageService.getById(imgid);

        return CommonResult.success();
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public CommonResult save(@RequestBody Shopimage shopimage){
		shopimageService.save(shopimage);

        return CommonResult.success();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public CommonResult update(@RequestBody Shopimage shopimage){
		shopimageService.updateById(shopimage);

        return CommonResult.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public CommonResult delete(@RequestBody Long[] imgids){
		shopimageService.removeByIds(Arrays.asList(imgids));

        return CommonResult.success();
    }

}
